var app = getApp();
Page({

  data: {
    info:[],
    date: '',
    liyou:'',
    date2:'',
    choose:'',
    itemList: ['正常', '返工','报废'],
    status:'点击选择状态',
    userInfo: null,
    title:'',
    buttom:'',
    zhicheng:''
  },

  

  onLoad: function (options) {},
  onShow:function(){
    var that = this
    this.getlist()
  },
  godetail: function(e) {
        wx.navigateTo({
          url: '/page/my/qingjiaodetail?id='+e.currentTarget.dataset.fee,
        });
  },

  bindDateChange: function(e) {
    console.log('picker发送选择改变，携带值为', e.detail.value)
    this.setData({
      date: e.detail.value
    })
    this.getlist()
  },


  bindDateChange2: function(e) {
    console.log('picker发送选择改变，携带值为', e.detail.value)
    this.setData({
      date2: e.detail.value
    })
    this.getlist()
  },

  getlist:function (){
    var that = this
    wx.request({
      url: app.apiUrl + '/api/index/jswgetbancilist',
      data: {
        openid:wx.getStorageSync('openid'),
        groupid:wx.getStorageSync('groupid')
      },
      method: 'post',
      header: {
        "Content-Type": "application/x-www-form-urlencoded",
      },
      success: function (res) {
        if(res.data.data.length > 0){
          that.setData({ info: res.data.data});
            
        }else{
          wx.showModal({
            title: '温馨提示',
               content: '暂无数据',
                 showCancel: false
            });
            setTimeout(function () {
              wx.redirectTo({
                url: '/page/my/index',
              }) 
            }, 2000)
            that.setData({ info: ''});
        }
     
      }
    });
  },


  tongguo:function (e){
    var that = this
    wx.request({
      url: app.apiUrl + '/api/index/bancitongguo',
      data: {
        openid:wx.getStorageSync('openid'),
        qid:e.currentTarget.dataset.fee,
      },
      method: 'post',
      header: {
        "Content-Type": "application/x-www-form-urlencoded",
      },
      success: function (res) {
        wx.showModal({
          title: '温馨提示',
          content: '通过成功',
          showCancel: false
        });
        that.getlist()
        // setTimeout(function () {
        //   wx.navigateTo({
        //     url: '/page/my/index',
        //   });
        // }, 2000)
      }
    });
  },



  jujue:function (e){
    var that = this
    wx.request({
      url: app.apiUrl + '/api/index/bancijujue',
      data: {
        openid:wx.getStorageSync('openid'),
        qid:e.currentTarget.dataset.fee,
      },
      method: 'post',
      header: {
        "Content-Type": "application/x-www-form-urlencoded",
      },
      success: function (res) {
        wx.showModal({
          title: '温馨提示',
          content: '操作成功',
          showCancel: false
        });
        that.getlist()
        // setTimeout(function () {
        //   wx.navigateTo({
        //     url: '/page/my/index',
        //   });
        // }, 2000)
      }
    });
  },


})